package com.leyou.item.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.item.dto.SpecParamDTO;
import com.leyou.item.entity.SpecParam;
import com.leyou.item.mapper.SpecParamMapper;
import com.leyou.item.service.SpecParamService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: YHL
 * @time: 2021/2/23 21:09
 */
@Service
public class SpecParamServiceImpl extends ServiceImpl<SpecParamMapper, SpecParam> implements SpecParamService {
    @Override
    public List<SpecParamDTO> listSpecParm(Long gid, Long cid, Boolean searching) {
        //select * from tb_spec_param [where group_id  = #{gid} and category_id = #{cid} and searching = #{searching}]
        return SpecParamDTO.convertEntityList(this.query()
                .eq(null!=gid,"group_id",gid)
                .eq(null!=cid,"category_id",cid)
                .eq(null!=searching,"searching",searching)
                .list());
    }
}
